/*
 * Implementa a Lista da Agenda
 * 
 */

package l10exercicioproposto;

/**
 * 12/05/2008 - PMLF
 * @author mdneto
 */
public class Agenda {
    final int MAX = 100;
    private AgendaEntry [] agenda;
    private Integer topoAgenda;
    
    public Agenda(){
        this.agenda = new AgendaEntry[MAX];
        this.topoAgenda = -1;
    }
    
    public boolean agendaVazia(){
        return (this.topoAgenda == -1);
    }
    
    public boolean agendaLimite(int pos){
        return pos > MAX;
    }
    
    public boolean agendaAdiciona(AgendaEntry ae){
        this.topoAgenda++;
        this.agenda[this.topoAgenda].setNome(ae.getNome());
        this.agenda[this.topoAgenda].setEmail(ae.getEmail());
        this.agenda[this.topoAgenda].setTelefone(ae.getTelefone());
        this.agenda[this.topoAgenda].setEndereco(ae.getEndereco());
        return true;
    }
    
    public boolean agendaExcluir(int pos){
        int i;
        if ( ( this.agendaVazia() ) || ( this.agendaLimite(pos + 1) ) )
            return false;
        
        for (i = pos; i < this.topoAgenda; i++) {
            
        }
        
        return true;
    }

    public boolean agendaModifica(int pos, AgendaEntry ae){
        if ( ( this.agendaVazia() ) || ( this.agendaLimite(pos + 1) ) )
            return false;
        
        agenda[pos].setNome(ae.getNome());
        agenda[pos].setEmail(ae.getEmail());
        agenda[pos].setTelefone(ae.getTelefone());
        agenda[pos].setEndereco(ae.getEndereco());
                
        return true;
    }
    
    public boolean agendaMostra(int pos){
        return true;
    }

    public boolean agendaMostraTodos(){
        return true;
    }
}
